home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / c_course.zip / BETTERIN.C < prev    next >
Text File  |  1989-12-30  |  640b  |  20 lines

  1. #include "stdio.h"
  2. #define CR 13       /* this defines CR to be 13 */
  3. #define LF 10       /* this defines LF to be 10 */
  4.  
  5. main()
  6. {
  7. char c;
  8.  
  9.    printf("Input any characters, hit X to stop.\n");
  10.  
  11.    do {
  12.       c = getch();                    /* get a character */
  13.       putchar(c);                     /* display the hit key */
  14.       if (c == CR) putchar(LF);       /* if it is a carriage return
  15.                                          put out a linefeed too */
  16.    } while (c != 'X');
  17.  
  18.    printf("\nEnd of program.\n");
  19. }
  20.